Tool Calling in BRX allows your AI applications to interact with external tools, APIs, and services. This enables BRKs to access real-time data, perform actions in the real world, and integrate with existing systems.
The most common form of Tool Calling is making HTTP requests to external APIs. Here’s an example of a BRK that calls a weather API:
Copy
Ask AI
const weatherBrk = { brxId: 'weather-api-brk', brxName: 'Weather API', description: 'Gets weather information for a location', prompt: { prompt: new Map([ ['main', ` Make an HTTP request to get weather information for {{location}}. URL: https://api.weather.com/v1/current?location={{location}}&units=metric Method: GET Headers: { "Authorization": "Bearer {{api_key}}", "Content-Type": "application/json" } Parse the response and extract the temperature, conditions, and forecast. `] ]) }, processParams: { processType: 0 }, dependantBrxIds: new Map([ ['main_brx_entry_schema', 'weather-api-brk'] ])};
BRX can also execute custom functions as part of a BRK:
Copy
Ask AI
const calculationBrk = { brxId: 'calculation-brk', brxName: 'Calculation', description: 'Performs a complex calculation', prompt: { prompt: new Map([ ['main', ` Execute the following JavaScript function: function calculate(a, b, c) { return (a * b) / c; } Input values: a = {{value_a}} b = {{value_b}} c = {{value_c}} Return the result of the calculation. `] ]) }, processParams: { processType: 0 }, dependantBrxIds: new Map([ ['main_brx_entry_schema', 'calculation-brk'] ])};